<?php
	require_once 'functions.php';
	dbConnect();
	
	$subject = "Kindlence User";
	$email = $_POST['kindleuser'] . $_POST['freeorpremium'];
	$categories = "";
	if(!empty($_POST['categories'])) {
		$categories = "Categories: " . implode(", ", $_POST['categories']);
	}

	if(mail($to, $subject, $body, $header)) {
		header("Location: ./sucessfully.html");
	} else {
		header("Location: ./error.html");
	}
?>